      SUBROUTINE CROSS(Z,L,N)
      COMPLEX Z(1),TEMP,B1
C     OBTAIN TWO FFT'S OF REAL-VALUED TIME HISTORIES SIMULTANEDUSLY
      NN=N
      CALL FOUR(Z,NN,-1)
      NH=N/2
      NH1=NH+1
      B1=AIMAG(Z(1))
      Z(1)=REAL(Z(1))
      DO 112 I=2,NH
      TEMP=0.5*(Z(I)+CONJG(Z(N+2-I)))
      Z(N+2-I)=(0.,-0.5)*(Z(I)-CONJG(Z(N+2-I)))
  112 Z(I)=TEMP
C     COMPUTE THE RAW CROSS SPECTRUM,S
      FN=FLOAT(N*L)
      Z(1)=CONJG(Z(1))*B1/FN
      DO 113 I=2,NH
  113 Z(I)=CONJG(Z(I))*Z(N+2-I)/FN
      Z(NH1)=AIMAG(Z(NH1))*REAL(Z(NH1))/FN
      DO 114 I=2,NH
  114 Z(N+2-I)=CONJG(Z(I))
C     COMPUTE THE INVERS FFT OF S TO OBTAIN THE CROSS CORRELATION
      CALL FOUR(Z,NN,1)
      A=REAL(Z(1))
      WRITE(6,5) A
    5 FORMAT(42H1CROSSCOVARIANCE FUNCTION AT THE ORIGIN = ,1PE10.3)
      WRITE(6,6)
    6 FORMAT(1H ,50X,29H CROSSCORRELATION COEFFICIENT)
      WRITE(6,7) SIG
    7 FORMAT(1X,1PE10.3)
      SIG=1.
      Z(1)=Z(1)/SIG
      DO 115 I=2,L
      Z(N+2-I)=Z(N+2-I)*FLOAT(L)/(SIG*FLOAT(L+1-I))
  115 Z(I)=Z(I)*FLOAT(L)/(SIG*FLOAT(L+1-I))
      RETURN
      END
